﻿using System;
using NUnit.Framework;
using Rainbow.ObjectFlow.Framework;
using Rainbow.ObjectFlow.Policies;
using Shouldly;

namespace Objectflow.core.tests
{
    public class RetryPolicySpecs
    {
        public partial class WorkflowSpecs
        {
            [Test]
            public void Create_Retry_with_last_operation()
            {
                var workflow = new Workflow<string>();
                workflow.Retry().ShouldBeTypeOf<Retry>();
            }

            [Test]
            public void Create_retry_with_last_operation()
            {
                var function = new Func<string, string>((x)=>"red");
                var workflow = new Workflow<string>().Do(function);
                var retry = workflow.Retry() as Rainbow.ObjectFlow.Policies.Policy;
                retry.Invoker.ShouldBe(function);
            }


        }
    }
}